package com.zline.foodraise.adapter;

import android.content.Context;
import android.support.v7.widget.RecyclerView;
import android.view.ViewGroup;

import com.zline.foodraise.entity.MsgBean;
import com.zline.foodraise.view.MsgCentreItem;
import com.zline.foodraise.view.MsgCentreItem_;
import com.zline.foodraise.view.RecyclerViewLoadMore_;

import org.androidannotations.annotations.EBean;
import org.androidannotations.annotations.RootContext;

/**
 * Created by heshantao on 15/11/13.
 * 消息中心
 */
@EBean
public class MsgCentreAdapter extends LoadRecyclerBaseAdapter<MsgBean,MsgCentreItem> {
    private static  final String LOG_TAG=MsgCentreAdapter.class.getSimpleName();
    @RootContext
    Context cxt;
    @Override
    protected MsgCentreItem onCreateItemView(ViewGroup parent, int viewType) {
        return MsgCentreItem_.build(cxt);
    }

    @Override
    protected BottomWrapper onCreateBottomView(ViewGroup parent, int viewType) {
        return new BottomWrapper(RecyclerViewLoadMore_.build(cxt));
    }

    @Override
    public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) {
        if (holder instanceof ContentWrapper) {
            MsgCentreItem view = (MsgCentreItem) ((ContentWrapper) holder).getView();
            MsgBean bean = (MsgBean) arrys.get(position);
            view.setRecycleItemClickListener(itemClicked);
            view.bind(bean,position);
        }
    }
}
